import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { renderIcon } from '@/utils/index';
import { CodeSandboxOutlined } from '@vicons/antd';

const routeName = 'statistics';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/statistics',
    name: routeName,
    redirect: '/statistics/daily',
    component: Layout,
    meta: {
      title: '统计数据',
      icon: renderIcon(CodeSandboxOutlined),
      permissions: ['statistics_daily'],
      sort: 5,
    },
    children: [
      {
        path: 'daily',
        name: `${routeName}_daily`,

        meta: {
          title: '每日数据',
          permissions: ['statistics_daily'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/daily/daily.vue'),
      },
      {
        path: 'arpu',
        name: `${routeName}_arpu`,

        meta: {
          title: '活跃留存',
          permissions: ['statistics_arpu'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/arpu/arpu.vue'),
      },
      {
        path: 'ltv',
        name: `${routeName}_ltv`,

        meta: {
          title: 'LTV统计',
          permissions: ['statistics_ltv'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/ltv/ltv.vue'),
      },
      {
        path: 'roi',
        name: `${routeName}_roi`,

        meta: {
          title: 'ROI统计',
          permissions: ['statistics_roi'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/roi/roi.vue'),
      },
      {
        path: 'gameArea',
        name: `${routeName}_gameArea`,

        meta: {
          title: '区服数据统计',
          permissions: ['statistics_gameArea'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/game/gameArea.vue'),
      },
      {
        path: 'anchorRegist',
        name: `${routeName}_anchorRegist`,

        meta: {
          title: '主播注册统计',
          permissions: ['statistics_anchorRegist'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/anchor/anchorRegist.vue'),
      },
      {
        path: 'rechargeRetention',
        name: `${routeName}_rechargeRetention`,

        meta: {
          title: '付费留存',
          permissions: ['statistics_rechargeRetention'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/recharge/rechargeRetention.vue'),
      },
      {
        path: 'customerRecord',
        name: `${routeName}_customerRecord`,

        meta: {
          title: '客服收录',
          permissions: ['statistics_customerRecord'],
          keepAlive: false,
        },
        component: () => import('@/views/statistics/customer/index.vue'),
      },
    ],
  },
];

export default routes;
